package com.cn.jiyun.contoller;

import com.cn.jiyun.entity.pojo.Food;
import com.cn.jiyun.entity.pojo.Hotel;
import com.cn.jiyun.entity.pojo.Meals;
import com.cn.jiyun.entity.pojo.Vouchers;
import com.cn.jiyun.service.FoodService;

import com.jiyun.result.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

@RestController
@RequestMapping("/food")
public class FoodController {

    @Resource
    private FoodService foodService;
    @PostMapping("/findAllFood")
    public Result<List<Food>> findAllFood(){
        return Result.ok(foodService.findAllFood());

    }
    @PostMapping("findFoodOrderByRating")
    public Result<List<Food>> findFoodOrderByRating(Integer rating){
        List<Food> listAll = foodService.findFoodOrderByRating(rating);
        return Result.ok(listAll);
    }

    @GetMapping("/findById/{foodId}")
    public Result<Food> findById(@PathVariable("foodId") Integer foodId) {
        Food food = foodService.getFoodId(foodId);
        return Result.ok(food);
    }
    @PostMapping("/findVouchers")
    Result<List<Vouchers>> findVouchers(Vouchers vouchers){
        List<Vouchers> list = foodService.findVouchers(vouchers);
        return Result.ok(list);
    }

    @PostMapping("/findMeals")
    public Result<List<Meals>> findVouchers(Meals meals){
        List<Meals> list = foodService.findMeals(meals);

        return Result.ok(list);

    }

    @GetMapping("/findMealById")
    public Result<Meals> findMealById(@RequestParam("packageId") Integer packageId){
        Meals meals = foodService.getMealById(packageId);
        return Result.ok(meals);
    }




}
